﻿@model Wenjian

<form action="@Url.Action("Avatar","Upload",new { id = Model.id,userId = ViewBag.Id })" method="post" enctype="multipart/form-data" target="upload">
    <img src="@Model.wjlj" height="240" width="240" onclick="chooseImage();" alt="@Model.ysmc"><br><br>
    <input type="file" name="file" id="avatar" style="left:-9999px; position:absolute;" accept="image/*" onchange="changeImage(this)" />
    <input type="submit" id="submit" value="上传头像" style="display:none;" /> 点击头像选择图片上传！
</form>

<script type="text/javascript">
    function chooseImage(){
        document.getElementById("avatar").click();
    }

    function changeImage(input) {
        if(input.files.length > 0) {
            document.getElementById("submit").style.display = '';
        }
    }
</script>